home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / pack.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  11.5 KB  |  383 lines

  1. '\"
  2. '\" Copyright 1990-1992 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/pack.man,v 1.6 92/03/21 15:49:26 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS pack cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. pack \- Geometry manager that packs around edges of cavity
  193. .SH SYNOPSIS
  194. \fBpack after \fIsibling \fIwindow options\fR ?\fIwindow options \fR...?
  195. .sp
  196. \fBpack append \fIparent \fIwindow options\fR ?\fIwindow options \fR...?
  197. .sp
  198. \fBpack before \fIsibling \fIwindow options\fR ?\fIwindow options \fR...?
  199. .sp
  200. \fBpack info \fIparent\fR
  201. .sp
  202. \fBpack unpack \fIwindow\fR
  203. .BE
  204.  
  205. .SH DESCRIPTION
  206. .PP
  207. The packer is a geometry manager that arranges the
  208. children of a parent by packing them in order around the edges of
  209. the parent.  The first child is placed against one side of
  210. the window, occupying the entire span of the window along that
  211. side.  This reduces the space remaining for other children as
  212. if the side had been moved in by the size of the first child.
  213. Then the next child is placed against one side of the remaining
  214. cavity, and so on until all children have been placed or there
  215. is no space left in the cavity.
  216. .PP
  217. The \fBbefore\fR, \fBafter\fR, and \fBappend\fR forms of the \fBpack\fR
  218. command are used to insert one or more children into the packing order
  219. for their parent.  The \fBbefore\fR form inserts the children before
  220. window \fIsibling\fR in the order;  all of the other windows must be
  221. siblings of \fIsibling\fR.  The \fBafter\fR form inserts the windows
  222. after \fIsibling\fR, and the \fBappend\fR form appends one or more
  223. windows to the end of the packing order for \fIparent\fR.  If a
  224. \fIwindow\fR named in any of these commands is already packed in
  225. its parent, it is removed from its current position in the packing
  226. order and repositioned as indicated by the command.  All of these
  227. commands return an empty string as result.
  228. .PP
  229. .VS
  230. The \fBunpack\fR form of the \fBpack\fR command removes \fIwindow\fR
  231. from the packing order of its parent and unmaps it.  After the
  232. execution of this command the packer will no longer manage
  233. \fIwindow\fR's geometry.
  234. .VE
  235. .PP
  236. The placement of each child is actually a four-step process;
  237. the \fIoptions\fR argument following each \fIwindow\fR consists of
  238. a list of one or more fields that govern the placement of that
  239. window.  In the discussion below, the term \fIcavity\fR refers
  240. to the space left in a parent when a particular child is placed
  241. (i.e. all the space that wasn't claimed by earlier children in
  242. the packing order).  The term \fIframe\fR refers to the space
  243. allocated to a particular child;  this is not necessarily the
  244. same as the child window's final geometry.
  245. .PP
  246. The first step in placing a child is to determine which side of
  247. the cavity it will lie against.  Any one of the following options
  248. may be used to specify a side:
  249. .TP
  250. \fBtop\fR
  251. Position the child's frame against the top of the cavity,
  252. occupying the full width of the cavity.
  253. .TP
  254. \fBbottom\fR
  255. Position the child's frame against the bottom of the cavity,
  256. occupying the full width of the cavity.
  257. .TP
  258. \fBleft\fR
  259. Position the child's frame against the left side of the cavity,
  260. occupying the full height of the cavity.
  261. .TP
  262. \fBright\fR
  263. Position the child's frame against the right side of the cavity,
  264. occupying the full height of the cavity.
  265. .LP
  266. At most one of these options should be specified for any given window.
  267. If no side is specified, then the default is \fBtop\fR.
  268. .PP
  269. The second step is to decide on a frame for the child.  For \fBtop\fR
  270. and \fBbottom\fR windows, the desired frame width is normally the cavity
  271. width and the desired frame height is the window's requested height,
  272. as passed to \fBTk_GeometryRequest\fR. For \fBleft\fR and \fBright\fR
  273. windows, the desired frame height is normally the cavity height and the
  274. desired width is the window's requested width.  However, extra
  275. space may be requested for the window using any of the following
  276. options:
  277. .TP 12
  278. \fBpadx \fInum\fR
  279. Add \fInum\fR pixels to the window's requested width before computing
  280. the frame size as described above.
  281. .TP 12
  282. \fBpady \fInum\fR
  283. Add \fInum\fR pixels to the window's requested height before computing
  284. the frame size as described above.
  285. .TP 12
  286. \fBexpand\fR
  287. This option requests that the window's frame absorb any extra space left over
  288. in the parent's cavity after packing all the children.
  289. The amount of space left over depends on the sizes requested by the
  290. other children, and may be zero.  If several windows have all specified
  291. \fBexpand\fR then the extra width will be divided equally among all the
  292. \fBleft\fR and \fBright\fR windows that specified \fBexpand\fR and
  293. the extra height will be divided equally among all the \fBtop\fR and
  294. \fBbottom\fR windows that specified \fBexpand.
  295. .LP
  296. If the desired width or height for a frame is larger than the corresponding
  297. dimension of the cavity, then the cavity's dimension is used instead.
  298. .PP
  299. The third step in placing the window is to decide on the window's
  300. width and height.  The default is for the window to receive either
  301. its requested width and height or the those of the frame, whichever
  302. is smaller.  If the frame is larger than the window's requested
  303. size, then the following options may be used to expand the
  304. window to partially or completely fill the frame:
  305. .TP
  306. \fBfill\fR
  307. Set the window's size to equal the frame size.
  308. .TP
  309. \fBfillx\fR
  310. Increase the window's width to equal the frame's width, but retain
  311. the window's requested height.
  312. .TP
  313. \fBfilly\fR
  314. Increase the window's height to equal the frame's height, but retain
  315. the window's requested width.
  316. .PP
  317. The last step is to decide the window's location within its frame.
  318. If the window's size equals the frame's size, then the window simply
  319. fills the entire frame.  If the frame is larger than the window,
  320. then one of
  321. the following options may be used to specify where the window should
  322. be positioned within its frame:
  323. .TP 15
  324. \fBframe center\fR
  325. Center the window in its frame.  This is the default if no framing
  326. option is specified.
  327. .TP 15
  328. \fBframe n\fR
  329. Position the window with its top edge centered on the top edge of
  330. the frame.
  331. .TP 15
  332. \fBframe ne\fR
  333. Position the window with its upper-right corner at the upper-right corner
  334. of the frame.
  335. .TP 15
  336. \fBframe e\fR
  337. Position the window with its right edge centered on the right edge of
  338. the frame.
  339. .TP 15
  340. \fBframe se\fR
  341. Position the window with its lower-right corner at the lower-right corner
  342. of the frame.
  343. .TP 15
  344. \fBframe s\fR
  345. Position the window with its bottom edge centered on the bottom edge of
  346. the frame.
  347. .TP 15
  348. \fBframe sw\fR
  349. Position the window with its lower-left corner at the lower-left corner
  350. of the frame.
  351. .TP 15
  352. \fBframe w\fR
  353. Position the window with its left edge centered on the left edge of
  354. the frame.
  355. .TP 15
  356. \fBframe nw\fR
  357. Position the window with its upper-left corner at the upper-left corner
  358. of the frame.
  359. .PP
  360. The \fBpack info\fR command may be used to retrieve information about
  361. the packing order for a parent.  It returns a list in the form
  362. .DS C
  363. \fIwindow options window options ...\fR
  364. .DE
  365. Each \fIwindow\fR is a name of a window packed in \fIparent\fR,
  366. and the following \fIoptions\fR describes all of the options for that
  367. window, just as they would be typed to \fBpack append\fR.
  368. The order of the list is the same as the packing order for
  369. \fIparent\fR.
  370. .PP
  371. The packer manages the mapped/unmapped state of all the packed
  372. children windows.  It automatically maps the windows when it packs
  373. them, and it unmaps any windows for which there was no space left
  374. in the cavity.
  375. .PP
  376. The packer makes geometry requests on behalf of the parent windows
  377. it manages.  For each parent window it requests a size large enough
  378. to accommodate all the options specified by all the packed children,
  379. such that zero space would be leftover for \fBexpand\fR options.
  380.  
  381. .SH KEYWORDS
  382. frame, geometry manager, location, packer, size
  383.